package com.dog.basics.admin.controller.mtkj;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dog.basics.bean.dto.admin.mtkj.FlowingWaterFromDto;
import com.dog.basics.bean.vo.admin.mtkj.FlowingWaterVo;
import com.dog.basics.common.annotation.SysLog;
import com.dog.basics.common.util.PageParam;
import com.dog.basics.common.util.R;
import com.dog.basics.service.mtkj.IMtDeviceFlowingWaterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 设备流水 前端控制器
 * </p>
 *
 * @author wph
 * @since 2020-09-29
 */
@RestController
@RequestMapping("/pc/device/flowing/water")
@Api(value = "设备流水模块", tags = "设备流水模块")
@AllArgsConstructor
public class MtDeviceFlowingWaterController {
    private final IMtDeviceFlowingWaterService mtDeviceFlowingWaterService;

    /**
     * @Description: 设备流水列表
     * @Param: FlowingWaterFromDto
     * @return: IPage<FlowingWaterVo>
     * @Author: wph
     * @Date:
     */

    @ApiOperation(value = "设备流水列表", notes = "pc:mtDeviceFlowingWater:page")
    @GetMapping("/page")
    @PreAuthorize("@pms.hasPermission('pc:mtDeviceFlowingWater:page')")
    public R<IPage<FlowingWaterVo>> page(PageParam page, FlowingWaterFromDto obj) {
        IPage<FlowingWaterVo> list = mtDeviceFlowingWaterService.getPageList(page, obj);
        return R.ok(list);
    }


    /**
     * @Description: 删除设备流水
     * @Param: ids
     * @return: Boolean
     * @Author: wph
     * @Date: 2020/05/19  0027
     */
    @SysLog("删除设备流水")
    @ApiOperation(value = "删除设备流水", notes = "pc:mtDeviceFlowingWater:delete")
    @ApiImplicitParam(value = "设备流水Id", name = "id", dataType = "Long", required = true)
    @DeleteMapping("/delete/{id}")
    @PreAuthorize("@pms.hasPermission('pc:mtDeviceFlowingWater:delete')")
    public R<Boolean> delete(@PathVariable("id") Long id) {
        return R.ok(mtDeviceFlowingWaterService.deleteObj(id));
    }

}
